class Solution {
public:
    string longestCommonPrefix(vector<string>& strs) {
        string a;
        bool judge = true;
        string demo = strs[0];
        for (int i = 0; i < demo.length(); i++) {
            for (int j = 0; j < strs.size(); j++) {
                if (demo[i] != strs[j][i]) { judge = false; }
            }
            if (judge == true) { a += demo[i]; }
            else { break; }
        }
        return a;
    }
};
